import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

/**
 *  每一种类型的页面都能适配一个 布局文件；
 *
 */
const routes = [
  {
    path: '/',
    component: () => import('../layouts/BlankLayout.vue'),
    redirect: '/login',
    children: [
      {
        path: '/login',
        name: 'Login',
        component: () => import('../views/login'),
      }
    ]
  },
  {
    path: '/users',
    component: () => import('../layouts/BasicLayout.vue'),
    redirect: '/user',
    children: [
      {
        path: '/',
        name: 'Users',
        component: () => import('../views/users'),
      }
    ]
  },
  {
    path: '/blogs',
    component: () => import('../layouts/BasicLayout.vue'),
    redirect: '/blogs',
    children: [
      {
        path: '/',
        name: 'Blogs',
        component: () => import('../views/blogs'),
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
